﻿using App9.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace App9.Models
{
    public class Key : BindableBase
    {
        char _Letter = default(char);
        public char Letter { get { return _Letter; } set { SetProperty(ref _Letter, value); } }

        bool _IsActive = default(bool);
        public bool IsActive { get { return _IsActive; } set { SetProperty(ref _IsActive, value); } }

        bool _IsTarget = default(bool);
        public bool IsTarget { get { return _IsTarget; } set { SetProperty(ref _IsTarget, value); } }

        public Key Clone()
        {
            return new Key
            {
                Letter = this.Letter,
                IsActive = this.IsActive,
                IsTarget = this.IsTarget,
            };
        }

        public enum Types { Upper, Lower, Numbers }
        public static Key[] Keys(Types type)
        {
            switch (type)
            {
                case Types.Upper:
                    return "ABCDEFGHIJKLMNOPQRSTUVWXYZ".Select(x => new Key { Letter = x }).ToArray();
                case Types.Lower:
                    return "abcdefghijklmnopqrstuvwxyz".Select(x => new Key { Letter = x }).ToArray();
                case Types.Numbers:
                    return "1234567890".Select(x => new Key { Letter = x }).ToArray();
                default:
                    throw new NotSupportedException();
            }
        }
    }
}
